package com.xxxx.seckill.config;
/**
 * @Author: Kong
 * @DateTime: 2022/5/17 21:07
 * @Description: TODO
 */

import com.xxxx.seckill.pojo.User;

/**
 * 添加用户到当前线程
 *
 * @auhtor kong
 * @description
 * @date 2022/5/1721:07
 */
public class UserContext {
    private static ThreadLocal<User> userHolder = new ThreadLocal<User>();

    public static void setUser(User user) {
        userHolder.set(user);
    }

    public static User getUser() {
        return userHolder.get();
    }
}
